package com.sx.zongzhi.presenter;

import com.sx.zongzhi.MyApplication;
import com.sx.zongzhi.bean.PublicBean;
import com.sx.zongzhi.modle.ApiManager;
import com.sx.zongzhi.net.BaseCallBack;
import com.sx.zongzhi.net.BaseResult;
import com.sx.zongzhi.view.IPublicBeanView;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by XZY on 2017/11/30.
 *根据字典项名称获取数据字典
 */
public class PublicListPest {

    private IPublicBeanView beanView;

    public PublicListPest(IPublicBeanView beanView) {
        this.beanView=beanView;
    }

    /**
     *
     * @param domainName 字典类型
     */
    public void getPublicList(String domainName){
        Map<String,Object> map=new HashMap<>();
        map.put("sid", MyApplication.sid);
        map.put("domainName", domainName);
        new ApiManager().getPublicList(map, new BaseCallBack<BaseResult<PublicBean>>() {
            @Override
            public void onSuccess(BaseResult<PublicBean> response) {
                beanView.getPublicList(response.getData());
            }
            @Override
            public void onFailures(String message) {
                beanView.showError(message);
            }
        });
    }


}
